package com.gxa.controller.zijincontroller;

import com.gxa.common.R;
import com.gxa.pojo.ShouKuanDan;
import com.gxa.service.zijinservice.ShouKuanService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhaohaoc
 * @version 1.0
 * @date 2022/3/31 14:01
 */

@Controller
@Api(value = "资金收款模块test",tags = "资金收款模块API")
@RequestMapping("/ziJin/shouKuanDan")
@RequiresPermissions(value = {"收款单", "收款单记录"}, logical = Logical.OR)
public class ShouKuanController {

    @Autowired(required = false)
    public R r;

    @Autowired(required = false)
    public ShouKuanService shouKuanService;

    @ResponseBody
    @RequestMapping(value = "/insterShouKuanDan",method = RequestMethod.POST)
    @ApiOperation(value = "收款单添加接口",notes = "添加收款单信息",httpMethod = "post", response = R.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "新增成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R insertShouKuanDan(@RequestBody ShouKuanDan shouKuanDan){
        return shouKuanService.insertShuoKuanDan(shouKuanDan);
    }

    @ResponseBody
    @RequestMapping(value = "/updateShouKuanDan",method = RequestMethod.POST)
    @ApiOperation(value = "收款单修改接口",notes = "修改收款单信息",httpMethod = "post", response = R.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "修改成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R updateShouKuanDan(@RequestBody ShouKuanDan shouKuanDan){
        return shouKuanService.updateShuoKuanDan(shouKuanDan);
    }

    @ResponseBody
    @RequestMapping(value = "/delShouKuanDan",method = RequestMethod.POST)
    @ApiOperation(value = "收款单删除接口",notes = "删除收款单信息",httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shouKuanDanBianHao", value = "收款单编号", paramType = "query", dataType = "String",
                    required = true)
    })
    @ApiResponses({
            @ApiResponse(code = 200,message = "删除成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R delShouKuanDan(String shouKuanDanBianHao
    ){
        return shouKuanService.delShouKuanDanByBianHao(shouKuanDanBianHao);
    }

    @ResponseBody
    @RequestMapping(value = "/selectShouKuanDan",method = RequestMethod.GET)
    @ApiOperation(value = "收款单查询接口",notes = "查询收款单信息",httpMethod = "get", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "Date",
                    required = false),
            @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "Date",
                    required = false),
            @ApiImplicitParam(name = "shouKuanDanBianHao", value = "单据编号", paramType = "query", dataType = "String",
                    required = false),
            @ApiImplicitParam(name = "keHuMingCheng", value = "客户名称", paramType = "query", dataType = "String",
                    required = false),
            @ApiImplicitParam(name = "shouKuanDanBeiZhu", value = "收款备注", paramType = "query", dataType = "String",
                    required = false)
    })
    @ApiResponses({
            @ApiResponse(code = 200,message = "查询成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R selectShouKuanDan(String startTime,String endTime,String shouKuanDanBianHao,String keHuMingCheng,
                               String shouKuanDanBeiZhu){
        return shouKuanService.selectShouKuanDan(startTime, endTime,
                shouKuanDanBianHao, keHuMingCheng, shouKuanDanBeiZhu);
    }

    @ResponseBody
    @RequestMapping(value = "/insertShouKuanDan/selectKeHu",method = RequestMethod.GET)
    @ApiOperation(value = "查询客户信息接口",notes = "查询客户",httpMethod = "get", response = R.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "查询成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R selectKeHu(){
        return shouKuanService.selectAllKeHu();
    }

    @ResponseBody
    @RequestMapping(value = "/insertShouKuanDan/selectZhangHu",method = RequestMethod.GET)
    @ApiOperation(value = "查询收款结算账户信息接口",notes = "查询收款结算账户",httpMethod = "get", response = R.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "查询成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R selectShouKuanZhangHu(){
        return shouKuanService.selectAllZhangHu();
    }

    @ResponseBody
    @RequestMapping(value = "/insertShouKuanDan/selectJieSuanWay",method = RequestMethod.GET)
    @ApiOperation(value = "查询收款结算方式信息接口",notes = "查询收款结算方式",httpMethod = "get", response = R.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "查询成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R selectShouKuanJieSuanWay(){
        return shouKuanService.selectJieSuanWay();
    }

    @ResponseBody
    @RequestMapping(value = "/insertShouKuanDan/selectXiaoHuoDan",method = RequestMethod.GET)
    @ApiOperation(value = "查询销货单信息接口",notes = "查询销货单",httpMethod = "get", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime", value = "开始日期", paramType = "query", dataType = "Date",
                    required = false),
            @ApiImplicitParam(name = "endTime", value = "结束日期", paramType = "query", dataType = "Date",
                    required = false),
            @ApiImplicitParam(name = "keHuMingCheng", value = "客户名称", paramType = "query",
                    dataType = "String", required = true),
            @ApiImplicitParam(name = "xiaoHuoDanBianHao", value = "销货单编号", paramType = "query",
                    dataType = "String", required = false),
    })
    @ApiResponses({
            @ApiResponse(code = 200,message = "查询成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404,message = "找不到页面"),
            @ApiResponse(code = 500,message = "后台服务错误")
    })
    public R selectXiaoHuoDan(String startTime,
                              String endTime,
                              String keHuMingCheng,
                              String xiaoHuoDanBianHao
                               ){
        return shouKuanService.selectXiaoHuoDan(startTime, endTime, keHuMingCheng, xiaoHuoDanBianHao);
    }
}
